home *** CD-ROM | disk | FTP | other *** search
- #include "defs.h"
- #include "Comm.h"
- #include "Database.h"
- #include "Random.h"
- #include "hotsync.h"
- #include "assert.h"
-
- /* these external variables are defined in main.c */
- extern unsigned long pc_id; /* PC Id read from global prefs file on startup */
- extern char username[256];
-
- /* pilot socket */
- int sd;
-
-
- /* performs the entire synchronization algorithm. This function is called in
- Tcl/Tk or directly from C in case a daemon is running */
- /* Arguments: none */
- /* Returns: always 0 (TCL_OK) */
- __TCL__ int HOTSYNCMANAGER()
- {
- int size;
- struct PilotUser U;
- struct DBList *list;
- int code;
- char path[256], logbuffer[1024]="";
-
- #ifdef __DEBUG
- printf("%s started: User is '%s'\n",__FILE__,username);
- #endif
-
- init_random_generator();
- pc_id = generate_pc_id();
-
- code = Tcl_Eval(g_interp, "progress -1 0 \"Synchronizing...\"");
-
- if (js_Start(&sd, &U, username, path) < 0) {
- js_CloseComm(sd, &U, logbuffer);
-
- strcpy(g_interp->result, "-1");
- return TCL_OK; /* not ok, but fool tcl/tk */
- }
-
- js_Connect(sd, &list, &size);
-
- js_Synch(sd, &U, list, size, path, logbuffer);
-
- free(list);
-
- js_CloseComm(sd, &U, logbuffer);
- code = Tcl_Eval(g_interp, "killprogress");
-
- strcpy(g_interp->result, username);
- return TCL_OK;
- }
-